/**
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 *   
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 * 
 */
package org.jiopi.blueprint.mailsender;

import org.jiopi.framework.annotation.blueprint.RegisterControlPanel;

/**
 * 
 * Simple Mail Sender
 * 
 * It should be a configuration singleton
 * 
 * @version 0.1 2010.6.13
 * @since 0.1 2010.6.13
 * @author netstarry
 *
 */
@Version
@RegisterControlPanel("jiopi.MailSender")
public interface MailSender {
	
	/**
	 * 
	 * Sends a text email. 
	 * <p>
	 * The formatting of to must comply with RFC 2822. Some examples are: 
	 * <ul>
	 *     <li>user@example.com</li>
	 *     <li>user@example.com,anotheruser@example.com</li>
	 *     <li>User <user@example.com></li>
	 *     <li>User <user@example.com>, Another User <anotheruser@example.com></li>
	 * </ul>
	 * 
	 * </p>
	 * @param to Receiver, or receivers of the mail. 
	 * @param subject Subject of the email to be sent
	 * @param message Message to be sent.
	 * @return the message id of the underlying MimeMessage
	 */
	@RegisterControlPanel("sendMail")
	public String sendMail(String to,String subject,String message) throws SendMailException;
	/**
	 * 
	 * send a html email
	 * 
	 * @param to
	 * @param subject
	 * @param html    html message
	 * @param text    alternative text
	 * @throws SendMailException
	 * @return the message id of the underlying MimeMessage
	 */
	public String sendMail(String to,String subject,String html,String text) throws SendMailException;
	
	/**
	 * create a new text Mail
	 * @return
	 */
	@RegisterControlPanel("createNewTextMail")
	public Mail createNewTextMail();
	
	/**
	 * create a new text Mail
	 * @return
	 */
	@RegisterControlPanel("createNewHtmlMail")
	public Mail createNewHtmlMail();
	
	/**
	 * 
	 * Gets the host name of the SMTP server
	 * 
	 * @return
	 */
	public String getHostName();
	
	/**
	 * login user name
	 * @return
	 */
	public String getAuthenticationUserName();
	
	/**
	 * login password
	 * @return
	 */
	public String getAuthenticationPassword();
	
	/**
	 * get from email address,comply with RFC 2822
	 * @return
	 */
	public String getFrom();
	
	/**
	 * get charset of mail
	 * @return
	 */
	public String getCharset();
}
